ECC (Error-correcting code) is a technology for data error checking and correction in data transmission. As comparing with parity checking, ECC uses less data for data checking and correction. For example, for a data of 256 bits, it only uses 32 bit ECC check for data checking. When the amount of bits to be transferred is increased to be two times of the original bits, it only needs to increase one bit by using ECC checking. The ECC can allow the data error in data transmission and the data can be corrected so that the whole system can be operated normally.
In the prior art ECC technology, one bit error can be detected, but for two bits error, the system cannot correct and thus the stability of the system is affected.
In the present invention, checksum means an operation, in that an original bit string is divided into two halves, a front half and a rear half. Firstly, a new bit string is formed by the front half to subtract the rear half and a borrow is set. The means when the result is negative, a borrow flag (a first flag) is set to 1, if the result is positive, the borrow flag is set to 0. The same operation is applied to the new bit string, but at this stage, the subtraction is performed by the rear half to subtract the front half, and thus a further new bit string is got and a further borrow is got (a second flag). The process is repeated until the bit string is a one bit string (called as a last bit). Then a new reconstructed bit string is got. The reconstructed bit string has a same bit number as the original bit string, but has the form defined as the following:
0 0 0 . . . second-flag first-flag last bit
Then the same operation is applied to the reconstructed bit string, but at this stage, the subtraction is performed by the rear half to subtract the front half. Then, the same operation is performed, but in the second operation, the subtraction is performed by the front half to subtract the rear half. The process is repeated until bit string has only one bit which is the checksum of the original bit string.
For example, the original bit string is 11011111. It is divided into a font half 1101 and a rear half 1111. Then the operation of 1101-1111 is performed, which get a result of 1110 and a borrow 1. Then the sting 1110 is divided into a front half of 11 and a rear half 10. Then the 10-11 to get a result of 11 and a flag of 1. Finally, 1-1 is preformed to have a result of 0.
The final bit and the borrow flags are combined to has a new string of 00000110 which is divided into a front half of 0000 and a rear half of 0110. Then 0110-0000 to have a result of 0110. Then 01-10 is performed to have a result of 11. Then 1-1 is performed to have a result of 0. Therefore, the checksum of 11011111 is 0.
Another operation is a bit sum which defined as that: for two strings, the bits of the same position are summed. For example, for two strings 0110 and 1010, the first bit (addition of the last bits of the two strings) is 0+0, the second bit is 1+1 (=10), the third bit is 1+0, and the fourth bit is 0+1. The result is 10000.
The present invention proposes to provide a new method for checking and correcting two bit transmission errors for a transmission of 128 bits by using least operations so that the overall bits in transmission is least and thus the transmission quality is not affected by the checking and correction operation.